/**
 * @param {number[]} nums
 * @param {number} target
 * @return {number[]}
 */
var searchRange = function(nums, target) {
  if (nums[0] > target || nums[nums.length - 1] < target) return [-1, -1]
  return [nums.indexOf(target), nums.lastIndexOf(target)]
}

console.log(searchRange([5, 7, 7, 8, 8, 10], 8))
